import java.util.Scanner;

public class Demo06 {
    public static void main(String[] args) {
        Scanner cin=new Scanner(System.in);
        int m,n,t;

        System.out.println("请输入两个正整数：");
        m=cin.nextInt();
        n=cin.nextInt();
        if(m<n) {
            t=m;m=n;n=t;
        }
        t=gong(m,n);
        System.out.println("最大公约数是"+t);
        System.out.println("最小公倍数是"+m*n/t);
        cin.close();
    }
    public static int gong(int a,int b){
        int k;

        while ((a % b) != 0) {
            k = a % b;
            a = b;
            b = k;
        }
        return b;
    }
}
